:root {
    --primary-color: #2563eb;
    --secondary-color: #1d4ed8;
    --accent-color: #3b82f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f3f4f6;
    --container-bg: #fff;
    --border-color: #e5e7eb;
    --shadow-color: rgba(37, 99, 235, 0.08);
    --history-bg: #f9fafb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --card-radius: 1.2rem;
    --card-shadow: 0 6px 24px var(--shadow-color);
    --btn-radius: 0.7rem;
    --btn-shadow: 0 2px 8px var(--shadow-color);
}

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --secondary-color: #2563eb;
    --accent-color: #60a5fa;
    --text-color: #f3f4f6;
    --text-light: #9ca3af;
    --bg-color: #111827;
    --container-bg: #1f2937;
    --border-color: #374151;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --history-bg: #374151;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--container-bg) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
    line-height: 1.7;
}

.theme-switch {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    background: var(--container-bg);
    padding: 0.5rem;
    border-radius: 2rem;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-light);
    transition: .4s;
    border-radius: 1.5rem;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.25rem;
    width: 1.25rem;
    left: 0.125rem;
    bottom: 0.125rem;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(1.5rem);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--container-bg);
    padding: 2.5rem 2rem;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

h1, h2, h3 {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-color);
    margin-bottom: 0.5em;
}

h1 {
    text-align: center;
    font-size: 2.7rem;
    margin-bottom: 2rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.2rem;
}

.section-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-description {
    color: var(--text-light);
    font-size: 1.1em;
    margin-top: 0.2em;
}

.conversion-type {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.type-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    background: var(--history-bg);
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s ease;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-btn i {
    font-size: 1.2em;
}

.type-btn.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.conversion-form {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    animation: slideUp 0.5s ease-out;
}

.input-group {
    flex: 1;
    display: flex;
    gap: 10px;
}

input, select, textarea {
    padding: 0.85rem 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--btn-radius);
    font-size: 1rem;
    background: var(--container-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px var(--shadow-color);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input {
    flex: 2;
}

select {
    flex: 1;
}

.swap-btn {
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.swap-btn:hover {
    transform: rotate(180deg);
    background: var(--secondary-color);
}

.unit-visualization {
    background: var(--history-bg);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-in;
}

.visual-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.visual-from, .visual-to {
    text-align: center;
    padding: 20px;
    background: var(--container-bg);
    border-radius: 10px;
    min-width: 150px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.visual-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
}

.visual-unit {
    color: var(--text-color);
    margin-top: 5px;
}

.visual-arrow {
    color: var(--primary-color);
    font-size: 1.5em;
}

.history-section {
    background: var(--history-bg);
    padding: 20px;
    border-radius: 10px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--container-bg);
    color: var(--primary-color);
}

#historyList {
    list-style: none;
}

#historyList li {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    animation: slideIn 0.3s ease-out;
}

#historyList li:last-child {
    border-bottom: none;
}

.floating-info {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    animation: slideUp 0.5s ease-out;
    z-index: 1000;
}

.info-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .conversion-form {
        flex-direction: column;
    }

    .swap-btn {
        transform: rotate(90deg);
    }

    .swap-btn:hover {
        transform: rotate(270deg);
    }

    .type-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .visual-container {
        flex-direction: column;
    }

    .floating-info {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* 在现有样式的基础上添加新工具的样式 */

.tools-nav {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 2.2rem;
    flex-wrap: wrap;
    padding: 0.7rem;
    background: var(--history-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--btn-shadow);
}

.tool-btn {
    padding: 0.85rem 1.7rem;
    border: none;
    border-radius: var(--btn-radius);
    background: transparent;
    cursor: pointer;
    font-size: 1.08rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: none;
}

.tool-btn:hover, .tool-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: var(--btn-shadow);
    transform: translateY(-2px) scale(1.04);
}

.tool-section {
    display: none;
    animation: fadeIn 0.5s ease-in;
    padding: 2rem 1.5rem;
    background: var(--container-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.tool-section.active {
    display: block;
}

/* 计算器样式 */
.calculator {
    max-width: 400px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.calc-display {
    margin-bottom: 20px;
}

.calc-display input {
    width: 100%;
    padding: 20px;
    font-size: 2em;
    text-align: right;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--container-bg);
    color: var(--text-color);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.calc-btn {
    padding: 15px;
    font-size: 1.2em;
    border: none;
    border-radius: 8px;
    background: var(--history-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.calc-btn:hover {
    background: var(--primary-color);
    color: white;
}

.calc-btn.operator {
    background: var(--primary-color);
    color: white;
}

/* 日期计算器样式 */
.date-calculator {
    max-width: 600px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.date-inputs {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.date-group {
    flex: 1;
}

.date-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
}

.date-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--container-bg);
    color: var(--text-color);
}

.date-results {
    background: var(--history-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-label {
    color: var(--text-color);
}

.result-value {
    font-weight: bold;
    color: var(--primary-color);
}

.date-actions {
    display: flex;
    gap: 10px;
}

.date-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.date-btn:hover {
    background: var(--secondary-color);
}

/* 颜色工具样式 */
.color-tools {
    max-width: 800px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.color-picker {
    margin-bottom: 30px;
}

.color-picker input[type="color"] {
    width: 100%;
    height: 100px;
    border: none;
    border-radius: 8px;
    margin-bottom: 20px;
}

.color-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.color-value {
    background: var(--history-bg);
    padding: 15px;
    border-radius: 8px;
}

.color-value label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
}

.color-value input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--container-bg);
    color: var(--text-color);
}

.color-palette h3 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.palette-color {
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.palette-color:hover {
    transform: scale(1.1);
}

/* 文本工具样式 */
.text-tools {
    max-width: 800px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.text-input {
    margin-bottom: 20px;
}

.text-input textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--container-bg);
    color: var(--text-color);
    resize: vertical;
    font-family: inherit;
}

.text-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.text-btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.text-btn:hover {
    background: var(--secondary-color);
}

.text-stats {
    background: var(--history-bg);
    padding: 20px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .tools-nav {
        gap: 10px;
    }

    .tool-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .date-inputs {
        flex-direction: column;
    }

    .text-stats {
        grid-template-columns: 1fr;
    }

    .color-values {
        grid-template-columns: 1fr;
    }
}

/* AI 聊天工具样式 */
.ai-chat {
    max-width: 800px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--history-bg);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
}

.message {
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--container-bg);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px var(--shadow-color);
}

.message.system .message-content {
    background: var(--primary-color);
    color: white;
}

.message.user .message-content {
    background: var(--history-bg);
}

.message-content i {
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.chat-input {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.chat-input textarea {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    resize: none;
    font-family: inherit;
}

.send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.chat-options {
    display: flex;
    gap: 0.75rem;
}

.option-btn {
    padding: 0.5rem 1rem;
    background: var(--history-bg);
    border: none;
    border-radius: 0.5rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-btn:hover {
    background: var(--border-color);
}

/* 翻译工具样式 */
.translation-tool {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--container-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

.translation-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.translation-box {
    background: var(--history-bg);
    border-radius: 0.75rem;
    overflow: hidden;
}

.translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--container-bg);
    border-bottom: 1px solid var(--border-color);
}

.language-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--container-bg);
    color: var(--text-color);
    font-size: 0.875rem;
}

.swap-lang-btn, .copy-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.swap-lang-btn:hover, .copy-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.translation-box textarea {
    width: 100%;
    padding: 1rem;
    border: none;
    background: var(--history-bg);
    color: var(--text-color);
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.translation-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.translate-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.translate-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.translation-history {
    background: var(--history-bg);
    padding: 1rem;
    border-radius: 0.75rem;
}

.translation-history h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#translationHistory {
    list-style: none;
}

#translationHistory li {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#translationHistory li:last-child {
    border-bottom: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .translation-container {
        grid-template-columns: 1fr;
    }

    .chat-messages {
        height: 300px;
    }

    .translation-options {
        flex-direction: column;
    }

    .translate-btn {
        width: 100%;
    }
}

.ai-message-text pre.ai-code {
    background: #f6f8fa;
    color: #222;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'Fira Mono', 'Consolas', monospace;
}
.ai-message-text code.ai-inline {
    background: #f3f3f3;
    color: #c7254e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.95em;
}
.ai-message-text ul {
    margin: 8px 0 8px 20px;
    padding: 0;
}
.ai-message-text li {
    list-style: disc;
    margin-left: 1em;
}

.ai-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e0e7ff;
    color: #2563eb;
    border-radius: 8px;
    padding: 10px 18px;
    margin: 10px 0;
    font-size: 1.05em;
    font-style: italic;
    min-width: 120px;
    max-width: 60%;
    box-shadow: 0 1px 3px var(--shadow-color);
}
.ai-thinking-dots {
    display: inline-block;
    width: 24px;
    text-align: left;
}
.ai-thinking-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 2px;
    background: #2563eb;
    border-radius: 50%;
    animation: thinking-bounce 1.2s infinite both;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

.games-selector {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 1.7rem;
}

.game-btn {
    padding: 0.85rem 1.7rem;
    border: none;
    border-radius: var(--btn-radius);
    background: var(--primary-color);
    color: white;
    font-size: 1.08rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--btn-shadow);
}

.game-btn:hover, .game-btn.active {
    background: var(--secondary-color);
    color: #fff;
    transform: scale(1.06);
}

.game-container {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.game-controls button {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-controls button:hover {
    background: var(--primary-color-dark);
}

.score, .status {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* 游戏画布样式 */
#snakeCanvas, #tetrisCanvas {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

/* 游戏网格样式 */
.game-2048 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #bbada0;
    padding: 10px;
    border-radius: 6px;
    width: 400px;
    height: 400px;
}

.game-2048 .tile {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    color: #776e65;
    transition: all 0.15s ease;
}

.game-2048 .tile[data-value="2"] { background: #eee4da; }
.game-2048 .tile[data-value="4"] { background: #ede0c8; }
.game-2048 .tile[data-value="8"] { background: #f2b179; color: #f9f6f2; }
.game-2048 .tile[data-value="16"] { background: #f59563; color: #f9f6f2; }
.game-2048 .tile[data-value="32"] { background: #f67c5f; color: #f9f6f2; }
.game-2048 .tile[data-value="64"] { background: #f65e3b; color: #f9f6f2; }
.game-2048 .tile[data-value="128"] { background: #edcf72; color: #f9f6f2; font-size: 1.8em; }
.game-2048 .tile[data-value="256"] { background: #edcc61; color: #f9f6f2; font-size: 1.8em; }
.game-2048 .tile[data-value="512"] { background: #edc850; color: #f9f6f2; font-size: 1.8em; }
.game-2048 .tile[data-value="1024"] { background: #edc53f; color: #f9f6f2; font-size: 1.5em; }
.game-2048 .tile[data-value="2048"] { background: #edc22e; color: #f9f6f2; font-size: 1.5em; }

/* 俄罗斯方块样式 */
#tetrisCanvas {
    border: 2px solid #333;
    background: #000;
    margin: 10px 0;
}

.game-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.game-controls button {
    padding: 8px 16px;
    font-size: 1em;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-controls button:hover {
    background: #45a049;
}

.game-controls button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* 响应式优化 */
@media (max-width: 900px) {
    .container {
        padding: 1rem;
    }
    .tool-section {
        padding: 1rem 0.5rem;
    }
    .game-container {
        padding: 1.2rem 0.2rem;
    }
}
@media (max-width: 600px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.1rem; }
    .tools-nav { gap: 0.5rem; }
    .game-btn, .tool-btn { padding: 0.5rem 0.7rem; font-size: 0.95rem; }
    .game-container { min-height: 260px; }
}

.anniversary-section {
    background: var(--history-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 2rem 1rem 1.5rem 1rem;
    margin-top: 2.5rem;
}
#anniversaryForm input[type="text"], #anniversaryForm input[type="date"] {
    min-width: 120px;
    max-width: 180px;
    margin-bottom: 0.5rem;
}
#anniversaryList {
    margin-top: 0.5rem;
}
.anniversary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--container-bg);
    border-radius: var(--btn-radius);
    box-shadow: 0 1px 4px var(--shadow-color);
    padding: 0.8em 1.2em;
    margin-bottom: 0.7em;
    font-size: 1.08em;
    gap: 1.2em;
}
.anniversary-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 1em;
}
.anniversary-date {
    color: var(--text-light);
    margin-right: 1em;
}
.anniversary-countdown {
    color: var(--success-color);
    font-weight: bold;
    margin-right: 1em;
}
.anniversary-delete {
    background: var(--error-color);
    color: #fff;
    border: none;
    border-radius: 0.5em;
    padding: 0.3em 0.9em;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}
.anniversary-delete:hover {
    background: #b91c1c;
}

.tool-mini-btn {
    padding: 0.7em 1.5em;
    border: none;
    border-radius: var(--btn-radius);
    background: var(--history-bg);
    color: var(--primary-color);
    font-size: 1.05em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--btn-shadow);
    margin-bottom: 0.2em;
}
.tool-mini-btn:hover, .tool-mini-btn.active {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.05);
}
.mini-tool { display: none; }
.mini-tool.active { display: block; }

/* 实用工具样式 */
.mini-tool {
    background: var(--container-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

/* 二维码生成器样式 */
.qrcode-generator {
    max-width: 600px;
    margin: 0 auto;
}

.qrcode-input {
    margin-bottom: 1.5rem;
}

.qrcode-input textarea {
    width: 100%;
    height: 100px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--container-bg);
    color: var(--text-color);
    resize: vertical;
    margin-bottom: 1rem;
}

.qrcode-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.qrcode-options select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--container-bg);
    color: var(--text-color);
}

.qrcode-options input[type="color"] {
    width: 50px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--container-bg);
}

.qrcode-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#qrcodeOutput {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* 图片压缩工具样式 */
.img-compress {
    max-width: 800px;
    margin: 0 auto;
}

.img-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.img-drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--history-bg);
}

.img-drop-zone i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.img-settings {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--history-bg);
    border-radius: 0.5rem;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    min-width: 100px;
}

.setting-group input[type="range"] {
    flex: 1;
}

.setting-group input[type="number"] {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--container-bg);
    color: var(--text-color);
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.preview-original,
.preview-compressed {
    background: var(--history-bg);
    padding: 1rem;
    border-radius: 0.5rem;
}

.preview-original h4,
.preview-compressed h4 {
    margin-bottom: 1rem;
    text-align: center;
}

.preview-original img,
.preview-compressed img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.img-info {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Markdown编辑器样式 */
.markdown-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: 400px;
}

.editor-input,
.editor-preview {
    background: var(--history-bg);
    border-radius: 0.5rem;
    overflow: hidden;
}

.editor-input textarea {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.markdown-preview {
    padding: 1rem;
    overflow-y: auto;
    color: var(--text-color);
}

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--history-bg);
    border-radius: 0.5rem;
}

.editor-toolbar .tool-btn {
    padding: 0.5rem;
    border: none;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.editor-toolbar .tool-btn:hover {
    background: var(--container-bg);
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .qrcode-options {
        flex-wrap: wrap;
    }
    
    .setting-group {
        flex-wrap: wrap;
    }
}

/* 计时器样式 */
.timer-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--container-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.timer-modes {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mode-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--btn-radius);
    background: var(--history-bg);
    color: var(--text-color);
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.time-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.time-input input {
    width: 80px;
    padding: 0.75rem;
    text-align: center;
    font-size: 1.5em;
    border: 2px solid var(--border-color);
    border-radius: var(--btn-radius);
    background: var(--container-bg);
    color: var(--text-color);
}

.time-input span {
    font-size: 1.5em;
    color: var(--text-color);
}

.timer-display {
    font-size: 4em;
    font-weight: bold;
    text-align: center;
    font-family: monospace;
    color: var(--primary-color);
    margin: 2rem 0;
    text-shadow: 0 2px 4px var(--shadow-color);
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.timer-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--btn-radius);
    background: var(--primary-color);
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timer-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.timer-btn i {
    font-size: 1.2em;
}

.lap-times {
    max-height: 200px;
    overflow-y: auto;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--history-bg);
    border-radius: var(--btn-radius);
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.lap-item:last-child {
    border-bottom: none;
}

.lap-number {
    font-weight: bold;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .timer-display {
        font-size: 2.5em;
    }

    .time-input input {
        width: 60px;
        font-size: 1.2em;
    }

    .timer-controls {
        flex-wrap: wrap;
    }

    .timer-btn {
        flex: 1;
        min-width: 120px;
    }
}

/* 密码生成器样式 */
.password-generator {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem;
}

.password-settings {
    margin-bottom: 1.5rem;
}

.password-result {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.password-result input {
    flex: 1;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 1.1rem;
}

.password-strength {
    margin-top: 1rem;
}

.strength-meter {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* 加密解密工具样式 */
.encryption-tool {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem;
}

.encryption-mode {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.encryption-input textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 1rem;
}

.encryption-settings {
    margin-bottom: 1rem;
}

.encryption-result {
    position: relative;
}

.encryption-result textarea {
    width: 100%;
    min-height: 100px;
}

/* 哈希计算器样式 */
.hash-calculator {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem;
}

.hash-input {
    margin-bottom: 1rem;
}

.hash-input textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 0.5rem;
}

.file-input {
    display: flex;
    justify-content: center;
}

.hash-result {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.hash-result input {
    flex: 1;
    font-family: monospace;
}

/* 正则表达式测试器样式 */
.regex-tester {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.regex-input {
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.input-group input,
.input-group textarea {
    width: 100%;
}

.input-group textarea {
    min-height: 100px;
}

.regex-settings {
    margin-bottom: 1rem;
}

.match-results {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* JSON格式化工具样式 */
.json-formatter {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.json-input textarea {
    width: 100%;
    min-height: 200px;
    margin-bottom: 1rem;
    font-family: monospace;
}

.json-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.json-result {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.json-result pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: monospace;
}

.json-status {
    color: #666;
    font-size: 0.9rem;
}

/* 通用按钮样式 */
.copy-btn,
.refresh-btn,
.format-btn,
.minify-btn,
.validate-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: #4a90e2;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

.copy-btn:hover,
.refresh-btn:hover,
.format-btn:hover,
.minify-btn:hover,
.validate-btn:hover {
    background: #357abd;
}

/* 深色模式适配 */
[data-theme="dark"] {
    .strength-meter {
        background: #444;
    }
    
    .match-results,
    .json-result {
        background: #2a2a2a;
    }
    
    .json-status {
        color: #999;
    }
}

/* 关于我们页面样式 */
.about-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.about-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease-in;
}

.about-section h3 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    color: var(--primary-color);
}

.about-section p {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: var(--history-bg);
    border-radius: var(--btn-radius);
    transition: transform 0.3s ease;
}

.feature-list li:hover {
    transform: translateX(5px);
}

.feature-list i {
    color: var(--success-color);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tool-card {
    background: var(--history-bg);
    padding: 1.5rem;
    border-radius: var(--btn-radius);
    text-align: center;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.tool-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tool-card h4 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.contact-info {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--history-bg);
    border-radius: var(--btn-radius);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.contact-link i {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .about-content {
        padding: 1rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .contact-info {
        flex-direction: column;
    }

    .contact-link {
        width: 100%;
        justify-content: center;
    }
}

/* 作者信息悬浮窗样式 */
.floating-author {
    position: fixed;
    z-index: 1001;
    width: 270px;
    background: var(--primary-color);
    color: #fff;
    padding: 0.8rem 1.2rem;
    border-radius: 2rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1rem;
    opacity: 0.95;
    justify-content: center;
    position: fixed;
    transition: opacity 1s ease;
}
.floating-author.fade-out {
    opacity: 0;
    pointer-events: none;
}
.left-author-info {
    left: 1.5rem;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    background: #20c05a !important;
}
.right-author-info {
    right: 1.5rem;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}
.author-content {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 500;
}
.floating-author i {
    font-size: 1.2rem;
}
.close-author-btn {
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    background: #fff;
    color: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    transition: background 0.2s, color 0.2s;
}
.left-author-info .close-author-btn {
    left: -18px;
    right: auto;
}
.close-author-btn:hover {
    background: var(--error-color);
    color: #fff;
}
@media (max-width: 600px) {
    .floating-author {
        width: 90vw;
        left: 5vw !important;
        right: 5vw !important;
        bottom: 1.2rem !important;
        font-size: 0.95rem;
        border-radius: 1.2rem;
    }
    .left-author-info, .right-author-info {
        left: 5vw !important;
        right: 5vw !important;
        bottom: auto !important;
        top: auto !important;
        margin-bottom: 0.5rem;
    }
    .close-author-btn {
        left: auto !important;
        right: 8px !important;
        top: 8px !important;
        transform: none !important;
    }
}

.pay-tip {
    margin-top: 0.5rem;
    color: #fff;
    font-size: 0.98rem;
    text-align: center;
    letter-spacing: 1px;
    opacity: 0.92;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.left-author-info .pay-tip {
    color: #eaffea;
}
.right-author-info .pay-tip {
    color: #eaf3ff;
} 